<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  

  <script>

    // 继承的概念
    class Person{
      constructor(name,age){
        this.name = name
        this.age=age
      }
      running(){ console.log("running") }
      eating(){ console.log("eating")}
    }

    class Teacher extends Person{}

    class Student extends Person{
      studying(){ console.log("studying")}
    }
    class SmallStudent extends Student{}
    class BigStudent extends Student{}


    var stu = new Student("why",18)
    console.log(stu)
    stu.running()
    stu.eating()
    stu.studying()

    // 继承有什么好处:
    // 1.增加代码复用

    
    // 2.继承是多态的前提(不用理解)

  </script>

</body>
</html>